package de.dhbw.horb.inf2013.vierFarbenProblem.view.java2D;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JPanel;

/**
 * The Class HexagonContainer.
 */
public class HexagonContainer extends JPanel {

	/** The hexagons. */
	protected List<Hexagon> hexagons = new LinkedList<>();

	/**
	 * Adds the hexagon.
	 * 
	 * @param hexagon
	 *            the hexagon
	 */
	public void addHexagon(Hexagon hexagon) {
		hexagons.add(hexagon);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
	 */
	@Override
	public void paintComponent(Graphics g) {
		Graphics2D g2d = (Graphics2D) g;

		for (Hexagon hexagon : hexagons) {
			hexagon.paint(g2d);
		}
	}

}